package concurrent

import (
	"sync"
)

type Concurrent struct {
	value int
	lock  sync.Mutex
}

func (a *Concurrent) Get() int {
	a.lock.Lock()
	defer a.lock.Unlock()
	return a.value
}

func (a *Concurrent) Set(v int) {
	a.lock.Lock()
	defer a.lock.Unlock()
	a.value = v
}

func (a *Concurrent) Increment() {
	a.lock.Lock()
	defer a.lock.Unlock()
	a.value++
}

func (a *Concurrent) Decrement() {
	a.lock.Lock()
	defer a.lock.Unlock()
	a.value--
}
